Date & Time Utilities
|
The date and time utilities provide facilities
for date and time conversion.
|
- A problem was found in Mac OS 9 where the
StringToDate
routine would add the current millennium read from the system clock to the year
when translating strings containing four-digit year fields between and including
the years 1000 through 1903. Here, the current millennium was
being read from the system clock and added to the year in the date being translated.
For example, if the time on the system clock was "March 1, 2000" and
StringToDate was asked to translate the string "March 24, 1901"
into a date, then the millennium from the system clock (2000) would be added to
the year resulting in the date March 24th, 3901. This behavior was
correct in the 1900's, but now that the century is 2000 as the date should have been translated as March 24th, 1901.
The implementation of StringToDate has been corrected so that such
dates are converted correctly. This problem was only present in the new PowerPC
native version of the Date & Time Utilities introduced in Mac OS 9
and has been corrected in Mac OS 9.0.4.
DOCUMENTATION CORRECTION
Inside Macintosh:Text p. 5-32 contains the statement
regarding the behavior of StringToDate :
|
"If the value of the input year is between 100 and 1000, then 1000
is added to it. Thus the dates 1/9/87, 1/9/987, and 1/9/1987 are
equivalent."
|
The actual behavior of StringToDate at the time when this
statement was made was to add the century from the system clock to
two-digit year values and to add the millennium from the system clock to
three-digit year values when they were being converted. Hence, back
in 1993, this sentence was true (1000, taken from the system clock, would
have been added to three-digit dates and 1900 would have been added
to two-digit dates when they were being converted).
But now that the century has changed to 2000, this sentence is no longer
true for two- and three-digit dates as StringToDate always adds
the century from the system clock to two digit year values and the
millennium from the system clock to three digit year values when they
are being converted. The statement should be changed to read as follows:
|
"If the value of the input year is between 100 and 1000, then the
current millennium from the system clock is added to it. Hence,
the dates returned by StringToDate for the strings
1/9/87, 1/9/987, and 1/9/1987 will vary according to the date
retrieved from the system clock when StringToDate
is called."
|
|
|